package com.wlk.utils;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class Result {
    private int code;
    private String message;
    private Object data;
    private String token;

    public Result(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Result(int code, String message, Object data, String token) {
        this.code = code;
        this.message = message;
        this.data = data;
        this.token = token;
    }

    public Result(int code,Object data){
        this.code = code;
        this.data = data;
    }

    public Result(int code,String message,String token){
        this.code = code;
        this.message = message;
        this.token = token;
    }

    public static Result ok(Object data){
        return new Result(200,"成功",data);
    }

    public static Result ok(String message){
        return new Result(200,message);
    }

    public static Result fail(String message){
        return new Result(-1,message);
    }


}